<template>
	<user-intergration :userIntergration="userIntergration" />
	<uni-section title="积分任务" class="" type="line"></uni-section>
	<template v-for="(item, index) in taskList" :key="index">
		<view class="sign">
			<view class="left">
				<view class="image-wrapper">
					<image :style="{
						'width': (item.logoWidth || 100) + 'rpx',
						'height': (item.logoHeight || 100) + 'rpx'
					}" :src="item.logoUrl" mode=""></image>
				</view>
				<view class="info">
					<view class="text">
						{{item.title}}
					</view>
					<view class="desc">
						{{item.desc}}
					</view>
				</view>
			</view>
			<view class="common-button button" @click="item.onClick">
				{{item.buttonText}}
			</view>
		</view>
	</template>
</template>

<script>
	export default {
		props: {
			/**
			 * 用户现有积分
			 */
			userIntergration: {
				type: Number,
				default: 0
			},
			/**
			 * 任务列表
			 */
			taskList: {
				type: Array,
				default: []
			},
		}
	}
</script>

<style lang="scss">
	page {
		background: #fff;
	}

	.sign {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 20rpx 10rpx;
		box-sizing: border-box;
		width: 700rpx;
		margin: 0 auto;
		border-bottom: 2rpx solid rgba(220, 220, 220, .6);

		.left {
			display: flex;

			.image-wrapper {
				display: flex;
				justify-content: center;
				align-items: center;
				width: 100rpx;
				height: 100rpx;
			}

			.info {
				margin-left: 20rpx;
				display: flex;
				flex-direction: column;
				justify-content: center;

				.text {
					font-weight: 500;
					font-size: 24rpx;
				}

				.desc {
					font-size: 24rpx;
					margin-top: 5rpx;
					color: rgba(150, 150, 150, .8);
				}
			}
		}

		.button {
			// padding: 0 20rpx;
			width: 140rpx;
			height: 60rpx;
			border-radius: 50rpx;
			display: flex;
			justify-content: center;
			align-items: center;

			button {
				display: flex;
				justify-content: center;
				align-items: center;
				width: 100%;
				height: 100%;
			}
		}
	}

	//通用按钮
	.common-button {
		background: linear-gradient(to right, #FEEF3C, #F3CD34);
		margin-left: none;
		border-radius: 0;
		font-size: 24rpx;
		color: #333;
	}

	//通用按钮取消内置样式
	.common-cancel-button {
		box-shadow: none;
		background: transparent;
		border: none;
		margin-left: initial;
		margin-right: initial;
		padding-left: initial;
		padding-right: initial;
		line-height: normal;
		color: #333;
		font-size: 24rpx;
		overflow: inherit;
	}

	.common-cancel-button::after {
		border: none;
	}
</style>